package domain;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component //这个注解就等价于在xml中配置bean
public class User {
    @Value("谦谦君") // 第一种值注入的方式
    private String name;

    private String school;

    @Value("西安交通大学")  // 第二种值注入的方式
    public void setSchool(String school) {
        this.school = school;
    }

    @Override
    public String toString() {
        return "User{" +
                "name='" + name + '\'' +
                ", school='" + school + '\'' +
                '}';
    }
}
